package algorithm.array;

import java.util.Arrays;

public class MinMoves {

    public static void main(String[] args) {
        int [] nums = {1,2,3};
        System.out.println(minMoves(nums));
    }

    public static int minMoves(int[] nums) {

        int asInt = Arrays.stream(nums).min().getAsInt();
        int res = 0;
        for (int num : nums) {
            res += num - asInt;
        } 
        return res;
    }
}
